<!DOCTYPE html>
<html lang="zh"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="../../build/css/ztree/metro/ztree.css" media="all" >
    <link rel="stylesheet" href="../../build/css/treeselect.css" media="all" >
    <link rel="stylesheet" href="../../plugins/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../plugins/font-awesome/css/font-awesome.min.css" media="all">
<body>
    <div class="layui-row">
        <!--暂时屏蔽,现有业务暂时用不到部门和角色管理-->
        <!--<div class="layui-col-md2">-->
            <!--<div>-->
                <!--<ul id="departmentTree" class="ztree"></ul>-->
            <!--</div>-->
        <!--</div>-->
        <div  class="layui-col-md12">
            <div class="layui-btn-group roleToolBar" style="margin-top: 5px">
                <div class="layui-btn-group" style="margin-left: 5px">
                    <button class="layui-btn layui-btn-sm"  data-type="addRole" shiro:hasPermission="upms:users:role:add">
                        <i class="layui-icon">&#xe654;</i>
                    </button>
                    <button class="layui-btn layui-btn-sm" data-type="deleteRoles" shiro:hasPermission="upms:users:role:delete">
                        <i class="layui-icon">&#xe640;</i>
                    </button>
                </div>
            </div>
            <hr class="layui-bg-red">
            <div>
                <table id="roles" lay-filter="roles"></table>
            </div>
        </div>
    </div>
    <div id="addRoleForm" class="layui-field-box" style="display: none;padding-top:45px;">
        <div class="layui-form" action="" method="post">
            <input type="hidden" name="id" value="0">
            <div class="layui-form-item">
                <label class="layui-form-label">角色名称</label>
                <div class="layui-input-block">
                    <input type="text" name="name" lay-verify="required" autocomplete="off" placeholder="请输入名称" class="layui-input" >
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">角色标题</label>
                <div class="layui-input-block">
                    <input type="text" name="title" lay-verify="required" autocomplete="off" placeholder="请输入角色标题" class="layui-input" >
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">角色描述</label>
                <div class="layui-input-block">
                    <input type="text" name="description"  autocomplete="off" placeholder="请输入角色描述" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">部门</label>
                <div class="layui-input-block layui-input-treeselect">
                    <input type="text" name="deptId"  required autocomplete="off"  class="layui-input" id="deptSelectTree" >
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">排序</label>
                <div class="layui-input-block">
                    <input type="text" name="orders"  lay-verify="required" autocomplete="off" placeholder="请输入排序" class="layui-input" >
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn layui-btn-radius" lay-submit lay-filter="addRoleSubmit">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-radius">重置</button>
                </div>
            </div>
        </div>
    </div>
    <div id="permissionTree" style="display: none">
        <div style="margin-top:5px;margin-left: 5px" class="roleToolBar">
            <button type="reset"class="layui-btn layui-btn-xs  layui-btn-normal"  data-type="saveRolePermission">分配权限</button>
        </div>
        <hr class="layui-bg-red">
        <div>
            <ul id="ztree" class="ztree"></ul>
        </div>
    </div>
    <shiro:hasAllPermissions name="upms:users:role:edit,upms:users:role:assPermissions,upms:users:role:delete">
        <script type="text/html" id="barMenus">
            <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="updateRole">修改</a>
            <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="assignPermission">权限</a>
            <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
        </script>
    </shiro:hasAllPermissions>
    <shiro:hasAllPermissions name="upms:users:role:edit,upms:users:role:assPermissions">
        <script type="text/html" id="barMenus">
            <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="updateRole">修改</a>
            <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="assignPermission">权限</a>
        </script>
    </shiro:hasAllPermissions>
    <shiro:hasAllPermissions name="upms:users:role:edit,upms:users:role:delete">
        <script type="text/html" id="barMenus">
            <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="updateRole">修改</a>
            <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
        </script>
    </shiro:hasAllPermissions>
    <shiro:hasAllPermissions name="upms:users:role:assPermissions,upms:users:role:delete">
        <script type="text/html" id="barMenus">
            <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="assignPermission">权限</a>
            <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
        </script>
    </shiro:hasAllPermissions>
    <script src="../../plugins/layui/layui.js"></script>
    <script src="../../businessJs/role.js"></script>
</body>
</html>